import  requests,json,re
#data数据请求
url='http://localhost:8080/jenkins/j_acegi_security_check'
namePassWord={
    'from':'',
    'j_username':'admin',
    'j_password':'123456',
    'from':'/jenkins/',
    'Jenkins-Crumb':'09156ccc5b30bb63fc1c13f2d9315e04',
    'json':{"j_username": "admin", "j_password": "123456", "remember_me":False, "from": "/jenkins/",
            "Jenkins-Crumb": "09156ccc5b30bb63fc1c13f2d9315e04"},
    'Submit':u'登录',
}

headersCode={
'Connection':'keep-alive',
'Content-Length':'311',
'Cache-Control':'max-age=0',
'Origin':'http://localhost:8080',
'Upgrade-Insecure-Requests':'1',
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101  \
              Safari/537.36',
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'Accept-Encoding':'gzip, deflate, br',
'Accept-Language':'zh-CN,zh;q=0.8',
'Cookie':'JSESSIONID=CB40C3D6F1431FE06BB420FE685035CF; screenResolution=1920x1080; hudson_auto_refresh=false',
}



responseCode=requests.post(url,headers=headersCode,data=namePassWord,verify=False)
print(responseCode.text)
print(re.findall(r'<b>(.+)</b>',responseCode.text))
